<template>
  <view class="success-container">
    <!-- 状态栏占位 -->
    <view class="status-bar" :style="{ height: statusBarHeight + 'px' }"></view>

    <!-- 顶部自定义导航 -->
    <view class="top-nav">
      <view class="nav-center">
        <text class="nav-title">下单完成</text>
      </view>
    </view>

    <!-- 成功卡片 -->
    <view class="card">
      <view class="icon-wrap">
        <view class="success-ring"></view>
        <text class="success-icon">✔</text>
      </view>
      <text class="success-title">下单成功</text>
      <text class="success-sub">我们正在为您准备美味，稍后送达</text>
    </view>

    <!-- 操作按钮 -->
    <view class="actions">
      <button class="primary" @click="goHome">继续购买</button>
      <button class="outline" @click="goOrders">查看订单</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      statusBarHeight: 0
    }
  },
  onLoad() {
    const systemInfo = uni.getSystemInfoSync()
    this.statusBarHeight = systemInfo.statusBarHeight || 20
    // 设置 CSS 变量，用于固定导航栏定位
    document.documentElement.style.setProperty('--status-bar-height', this.statusBarHeight + 'px')
  },
  methods: {
    goHome() {
      uni.reLaunch({ url: '/pages/home/home' })
    },
    goOrders() {
      uni.navigateTo({ url: '/pages/orders/orders' })
    }
  }
}
</script>

<style lang="scss" scoped>
.success-container {
  min-height: 100vh;
  background: linear-gradient(180deg, #fff7ec 0%, #fff 40%);
}

.status-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: transparent;
  z-index: 999;
}

.top-nav {
  position: fixed;
  top: var(--status-bar-height);
  left: 0;
  right: 0;
  height: 88rpx;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  z-index: 998;
  
  .nav-title {
    font-size: 32rpx;
    font-weight: 700;
    color: #333;
  }
}

.card {
  margin-top: calc(var(--status-bar-height) + 88rpx + 60rpx); // 状态栏 + 导航栏 + 间距
  margin-left: 40rpx;
  margin-right: 40rpx;
  margin-bottom: 20rpx;
  background: #fff;
  border-radius: 24rpx;
  padding: 60rpx 40rpx;
  box-shadow: 0 20rpx 40rpx rgba(255, 166, 0, 0.15);
  text-align: center;
  
  .icon-wrap {
    position: relative;
    width: 160rpx;
    height: 160rpx;
    border-radius: 50%;
    margin: 0 auto 20rpx;
    display: flex;
    align-items: center;
    justify-content: center;
    
    .success-ring {
      position: absolute;
      width: 160rpx;
      height: 160rpx;
      border-radius: 50%;
      background: radial-gradient(circle at center, #ffe3b3 0%, rgba(255,165,0,0.0) 60%);
      filter: blur(2rpx);
    }
    
    .success-icon {
      position: relative;
      z-index: 1;
      font-size: 72rpx;
      color: #ff8a00;
      font-weight: 800;
    }
  }
  
  .success-title {
    display: block;
    font-size: 40rpx;
    font-weight: 800;
    color: #333;
    margin-bottom: 10rpx;
  }
  
  .success-sub {
    display: block;
    font-size: 26rpx;
    color: #8a8a8a;
  }
}

.actions {
  margin: 30rpx 40rpx 0;
  display: flex;
  gap: 20rpx;
  
  .primary {
    flex: 1;
    height: 88rpx;
    border-radius: 44rpx;
    background: linear-gradient(135deg, #ff8a00 0%, #ffa726 100%);
    color: #fff;
    font-size: 30rpx;
    font-weight: 700;
    border: none;
  }
  
  .outline {
    flex: 1;
    height: 88rpx;
    border-radius: 44rpx;
    background: #fff;
    color: #ff8a00;
    font-size: 30rpx;
    font-weight: 700;
    border: 2rpx solid #ffcc80;
  }
}
</style>
